package xx.adapter.design;

/**
 * @Classname VoltageAdapter
 * @Description TODO 对象适配器模式-适配器类
 * @Date 2023/7/25 09:06
 * @Created by wangxianlin
 */
public class VoltageAdapterNew implements Voltage5V{

    private Voltage220V voltage220V;

    public VoltageAdapterNew(Voltage220V voltage220V) {
        super();
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        int src = voltage220V.output220V();
        System.out.println("原始电压：" + src + "V");
        int dst = src / 44; // 将220V电压转换成5V电压
        System.out.println("转换后电压：" + dst + "V");
        return dst;
    }
}
